package com.binfei.yjs.server.controller;


import com.binfei.yjs.server.model.entity.Entity1;
import com.binfei.yjs.server.model.entity.Entity2;
import com.binfei.yjs.server.model.response.ApiBaseDTO;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@Slf4j
@Tag(name = "Hello接口")
@RestController
@RequestMapping("/hello")
public class HelloController {

//    /**
//     * TODO 字段加了 void 所有的子字段data类型都是object
//     * @param data
//     * @return
//     */
//    @Operation(summary = "提交新内容", description = "参数类型 Entity1, 接口data字段类型 Entity1")
//    @PostMapping("pushNew")
//    public ApiBaseDTO<Void> pushNew(@RequestBody(required = false) Entity1 data) {
//        return ApiBaseDTO.success();
//    }

    @Operation(summary = "获取一条数据 Entity1", description = "参数类型 Entity1, 接口data字段类型 Entity1")
    @GetMapping("getOneEntity1")
    public ApiBaseDTO<Entity1> getOneEntity1(@RequestBody(required = false) Entity1 postData) {
        Entity1 data = new Entity1();
        return ApiBaseDTO.success(data);
    }

    @Operation(summary = "获取一条数据 Entity2", description = "参数类型 Entity1, 接口data字段类型 Entity2")
    @PostMapping("getOneEntity2")
    public ApiBaseDTO<Entity2> getOneEntity2(@RequestBody(required = false) Entity1 postData) {
        Entity2 data = new Entity2();
        return ApiBaseDTO.success(data);
    }

    @Operation(summary = "获取一条数据 Entity1 Null", description = "参数类型 Entity1, 接口data字段类型 Entity1, 返回Null")
    @GetMapping("getOneEntity1WithNull")
    public ApiBaseDTO<Entity1> getOneEntity1WithNull(@RequestBody(required = false) Entity1 postData) {
        return null;
    }

    @Operation(summary = "获取一条数据 Entity2 Null", description = "参数类型 Entity1, 接口data字段类型 Entity2, 返回Null")
    @PostMapping("getOneEntity2WithNull")
    public ApiBaseDTO<Entity2> getOneEntity2WithNull(@RequestBody(required = false) Entity1 postData) {
        return null;
    }

}
